import request from '@/utils/request'

export function fetchList() {
  return request({
    url: 'system/organization/tree',
    method: 'get'
  })
}

export function add(parentId, name, sort) {
  return request({
    url: 'system/organization/add',
    method: 'post',
    params: {
      parentId: parentId,
      name: name,
      sort: sort
    }
  })
}

export function detail(id) {
  return request({
    url: 'system/organization/detail',
    method: 'get',
    params: {
      id: id
    }
  })
}

export function del(id) {
  return request({
    url: 'system/organization/delete',
    method: 'delete',
    params: {
      id: id
    }
  })
}

export function modify(id, parentId, name, sort) {
  return request({
    url: 'system/organization/modify',
    method: 'post',
    params: {
      id: id,
      parentId,
      name,
      sort
    }
  })
}
